#include <stdio.h>

int main(int argc, char *argv[])
{

    int n = 0;
    scanf("%d", &n);
    int nums[n];
    for (size_t i = 0; i < n; i++)
    {
        scanf("%d", &nums[i]);
    }
    int next = 0;
    scanf("%d", &next);
    int tnum[n], in = 0, k = n - next;
    int count = n;
    while (count--)
    {
        //将k置位0才可以符合下一个if条件
        if (k >= n)
            k = 0;

        //nums 从下标0开始
        if (k < n - next)
            tnum[in++] = nums[k++];
        else
            tnum[in++] = nums[k++];
    }

    for (size_t i = 0; i < n; i++)
    {
        printf("%d ", tnum[i]);
    }

    return 0;
}